package com.bm.server.util;


import com.bm.server.type.RCode;
import com.bm.server.vo.R;

public class Rutils {
    public static R setR(int code, String msg, Object data){
        R r=new R();
        r.setCode(code);
        r.setMsg(msg);
        r.setData(data);
        return r;
    }
    /*
     * 成功*/
    public static R ok(String msg,Object data){
        return setR(RCode.成功.getCode(), msg,data);
    }
    /*
     * 成功*/
    public static R ok(Object data){
        return setR(RCode.成功.getCode(), "OK",data);
    }
    /*
     * 成功*/
    public static R ok(){
        return setR(RCode.成功.getCode(), "OK",null);
    }
    /*
     * 失败*/
    public static R fail(String msg){
        return setR(RCode.失败.getCode(), msg,null);
    }
    /*
     * 成功*/
    public static R fail(){
        return setR(RCode.失败.getCode(), "FAIL",null);
    }
    
}
